#!/bin/bash
#set -x

userIndex=$(curl --head http://10.51.3.2/eportal/gologout.jsp | grep '^Location:' | sed -e 's/^.*userIndex=//')

curl -X POST -H "User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0" -H "Accept-Encoding: gzip, deflate" -H "Connection: keep-alive" -d "userIndex=${userIndex}" 'http://10.51.3.2/eportal/InterFace.do?method=logout'

#curl -v 'http://10.51.3.2/eportal/InterFace.do?method=login' -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0" -H "Accept-Encoding: gzip, deflate" -H "Connection: keep-alive" -H "Referer: ${login_url}" -d 'userId=20050219' -d "password=${pass}" --data-urlencode 'service=教职工服务' --data-urlencode "queryString=${query}"

#echo "userIndex=${userIndex}"
